<?php
/**
 +----------------------------------------------------------
 * 发票操作日志类
 +----------------------------------------------------------
 * Author: ExBOY
 * Time: 2014-03-18 $ 20160603 更新 wangjianjun
 * [Ecos!] (C)2003-2014 Shopex Inc.
 +----------------------------------------------------------
 */
class invoice_mdl_order extends dbeav_model{
    
    //是否有导出配置
    var $has_export_cnf = true;
    var $export_name = '发票列表';
    
	var $defaultOrder = array('id',' desc');
    
    //获取发票内容
    function modifier_content_id($row){
        $mdlInContent = app::get('invoice')->model('content');
        $content = '商品明细';
        $rs_content = $mdlInContent->dump(array('content_id'=>$row),'content_name');
        if($rs_content){
            $content = $rs_content['content_name'];
        }
        return $content;
    }
    
    //获取操作人名
    function modifier_operator($row){
        $mdlDesktopUsers = app::get('desktop')->model('users');
        $operator_name = "system";
        if( intval($row)>0 ){
            $rs_user = $mdlDesktopUsers->dump(array("user_id"=>$row));
            $operator_name = $rs_user["name"];
        }
        return $operator_name;
    }
    
    //导出 字段配置 移除不需要的字段
    public function disabled_export_cols(&$cols){
        unset($cols['column_edit']);
        unset($cols['column_remind']);
    }
    
    //扩展字段先定义
    function extra_cols(){
        return array(
            'column_ship_status' => array('label'=>'发货状态','width'=>'75','func_suffix'=>'ship_status'),
            'column_pay_status' => array('label'=>'付款状态','width'=>'75','func_suffix'=>'pay_status'),
        );
    }
    
    //发货状态扩展字段格式化
    function extra_ship_status($rows){
        return kernel::single('invoice_extracolumn_order_shipstatus')->process($rows);
    }
    
    //付款状态扩展字段格式化
    function extra_pay_status($rows){
        return kernel::single('invoice_extracolumn_order_paystatus')->process($rows);
    }

}